#ifndef MIPS_REGDEF_H
#define MIPS_REGDEF_H
#include <stddef.h>
extern const char *regname[];
extern const int regname_size;
struct greg_num {
    const int *num;
    size_t nums;
    const int *ret;
    size_t rets;
    const int *arg;
    size_t args;
    const int *caller;  // TEMP REG
    size_t callers;
    const int *callee;  // SAVE REG
    size_t callees;
    int jp;
    int gp;
    int sp;
    int fp;
    int ra;
    int hi;
    int lo;
};
extern struct greg_num mips_greg_num;
struct freg_num {
    const int *num;
    size_t nums;
    const int *ret;
    size_t rets;
    const int *arg;
    size_t args;
    const int *caller;
    size_t callers;
    const int *callee;
    size_t callees;
    int cr;
};
union float_fcr {
    unsigned int fcr31;
    struct {
        unsigned int rm:2;     // Rounding mode bits
        unsigned int flags:5;  // Flag bits
        unsigned int enabled:6;// Enable bits
        unsigned int cause:5;  // Cause bits
        unsigned int zero:5;
        unsigned int c:1;      // Condition bit
        unsigned int fs:7;     // When set, denormalized results are flushed to 0 instead of causing an unimplemented operation exception
    }b;
};

#define FLT_RM_RN 0   // Round result to nearest representable value
#define FLT_RM_RZ 1   // Round toward 0
#define FLT_RM_RP 2   // Round toward +∞
#define FLT_RM_RM 3   // Round toward –∞

#define FLT_FLAG_I 0      // Inexact Operation
#define FLT_FLAG_U 2      // Underflow
#define FLT_FLAG_O 4      // Overflow
#define FLT_FLAG_Z 8      // Division by Zero
#define FLT_FLAG_V 0x10   // Invalid Operation
#define FLT_ENABLE_V 0x20 // Unimplemented Operation

extern struct freg_num mips_freg_num;

#define GET_REGNAME(num) (regname[num])
#define GET_GREGNAME(n) (GET_REGNAME(mips_greg_num.num[n]))
#define GET_FREGNAME(n) (GET_REGNAME(mips_freg_num.num[n]))
#define GET_FREG(x, n) (GET_REGNAME(mips_freg_num.x[n]))



#endif
